package com.lcgroup.springdemo.demos.controller;

import com.lcgroup.springdemo.demos.annotation.CustomAnnotation;
import com.lcgroup.springdemo.demos.bean.ResultResponse;
import com.lcgroup.springdemo.demos.service.TestService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("")
public class TestController {

    @Resource
    private TestService testService;

    @GetMapping("/interceptor")
    public ResultResponse<String> testException(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));
    }
    @GetMapping("/filter")
    public ResultResponse<String> testException2(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));
    }

    @GetMapping("/aop")
    @CustomAnnotation(val="CustomAnnotation")
    public ResultResponse<String> testException3(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));
    }

    @GetMapping("/security")
    public ResultResponse<String> security(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));
    }

    @GetMapping("/app/securityFilterChain0")
    public ResultResponse<String> security0(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));

    }
    @GetMapping("/securityFilterChain1")
    public ResultResponse<String> security1(Integer fm) {
        return new ResultResponse<>(testService.throwException(fm));
    }
}
